import {IMock} from './i-mock';
import {MockConfigItem} from '../../entity/mock-config-item';

export class CharMock implements IMock {
    getBaseTypeMockConfigDisplay(mockConfigItem: MockConfigItem): string {
        if (mockConfigItem.mockType === 1) {
            return 'random()';
        }
        if (!mockConfigItem.value || mockConfigItem.value === '') {
            return 'null';
        }
        return `"${mockConfigItem.value}"`;
    }

    onSave(mockConfigItem: MockConfigItem): boolean {
        if (mockConfigItem.mockType === 0 && mockConfigItem.value && mockConfigItem.value.length > 1) {
            return false;
        }

        return true;
    }
}
